<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>机构管理</title>
	<%@include file="/WEB-INF/views/include/head.jsp" %>
	<script type="text/javascript">
		var myValidate;
		$(document).ready(function() {
			var height=$(window).height()-70;
			$('#myOfficeForm').height(height)
			//$("#officeName,#areaName").after("<label class='err'>*</lable>");
			myValidate=$("#inputForm").validate({
				submitHandler: function(form){
					layer.msg('正在提交，请稍等...',{icon:16});
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$(element).closest( "form" )
					.find( "span[for='" + element.attr( "name" ) + "']" ).html(error);
				}
			});
		});
	</script>

</head>
<body style="overflow: hidden;">
	<ul class="nav nav-tabs">
		<li><a href="${ctxAdmin}/sys/office/list">机构列表</a></li>
		<li class="active"><a href="${ctxAdmin}/sys/office/form"><shiro:hasPermission name="sys:office:edit">${not empty office.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:office:edit">查看</shiro:lacksPermission>机构</a></li>
	</ul>
	<div id="myOfficeForm" style="overflow-y: auto;overflow-x:hidden">
			<form:form id="inputForm" modelAttribute="office" action="${ctxAdmin}/sys/office/save" method="post" class="form-horizontal">
				<form:hidden path="id"/>
				<sys:message content="${message}"/>
<%-- 				<div class="form-group">
					<label class="col-sm-3 control-label">上级机构:</label>
					<div class="col-sm-5">
		                <sys:treeselect id="office" name="parent.id" value="${office.parent.id}" labelName="parent.name" labelValue="${office.parent.name}"
							title="机构" url="/sys/office/treeData" formId="inputForm" extId="${office.id}" cssClass="required" allowClear="${office.currentUser.admin}"/>
					</div>
					<div class="col-sm-2">
						<span for="parent.name"></span>
						<font color="red">*</font>
					</div>
				</div> --%>
				

				<div class="form-group">
					<label class="col-sm-3 control-label">上级机构:</label>
					<div class="col-sm-5">
					<input readonly="readonly" value="${office.parent.name}" class="form-control"/>
					<input type="hidden" name="parent.id" value="${office.parent.id}"/>
					</div>
				</div>
							
				<div class="form-group">
					<label class="col-sm-3 control-label">所属区域:</label>
					<div class="col-sm-5">
		                <sys:treeselect id="area" name="area.id" value="${office.area.id}" labelName="area.name" labelValue="${office.area.name}"
							title="区域" url="/sys/area/treeData" cssClass="required"/>
					</div>
					<div class="col-sm-2">
						<span for="area.name"></span>
						<font color="red">*</font>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">机构名称:</label>
					<div class="col-sm-5">
						<form:input path="name" htmlEscape="false" maxlength="50" class="required form-control"/>
					</div>
					<div class="col-sm-2">
						<span for="name"></span>
						<font color="red">*</font>
					</div>
				</div>
		
				<div class="form-group">
					<label class="col-sm-3 control-label">机构编码:</label>
					<div class="col-sm-5">
						<form:input path="code" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
			
<%-- 						
				<div class="form-group">
					<label class="col-sm-3 control-label">机构级别:</label>
					<div class="col-sm-5">
						<form:select path="grade" cssStyle="width:120px" class="form-control m-b">
							<form:options items="${fns:getDictList('sys_office_grade')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div> --%>

			 	<div class="form-group">
					<label class="col-sm-3 control-label">排序号:</label>
					<div class="col-sm-3" style="width: 120px">
						<input name="sort" value="${office.sort}" class="number required form-control"/>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-3 control-label">联系地址:</label>
					<div class="col-sm-5">
						<form:input path="address" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
<%-- 				<div class="form-group">
					<label class="col-sm-3 control-label">邮政编码:</label>
					<div class="col-sm-5">
						<form:input path="zipCode" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div> --%>
				<div class="form-group">
					<label class="col-sm-3 control-label">联系人:</label>
					<div class="col-sm-5">
						<form:input path="master" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">联系电话:</label>
					<div class="col-sm-5">
						<form:input path="phone" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">传真:</label>
					<div class="col-sm-5">
						<form:input path="fax" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">邮箱:</label>
					<div class="col-sm-5">
						<form:input path="email" htmlEscape="false" maxlength="50" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">备注:</label>
					<div class="col-sm-5">
						<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="form-control"/>
					</div>
				</div>

				<div class="form-group">
					<div class="col-sm-5 col-sm-offset-3">
					<shiro:hasPermission name="sys:office:edit"><input id="btnSubmit" class="btn btn-success btn-sm" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
					<input id="btnCancel" class="btn btn-sm" type="button" value="返 回" onclick="history.go(-1)"/>
					</div>
				</div>
			</form:form>
	</div>
</body>
</html>